<template>
	<view>
		
	</view>
</template>
<script>
	import "static/css/all.css"

	export default {
		
		data() {
			return {
				show: true, //用户协议,true默认显示
				content: '', //用户协议内容
			}
		},
		onLaunch: function() {
			console.log('App Launch')


			
			this.getlogin()

		},
		onShow: function() {
			console.log('App Show')

		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			
			getlogin() {
				let that = this
				uni.login({
					provider: 'weixin',
					success: function(loginRes) {
						// console.log(loginRes, '=-=-=-=-=-')
						uni.$u.http.post('user/postopenid', {
							code: loginRes.code
						}).then(res => {
							uni.setStorageSync('openid', res.data.openid)
							uni.$u.http.post('user/Userauthorization', {
								openid: uni.getStorageSync('openid'),
								nickname: '微信用户',
								user_nickname: '微信用户',
								avatar: 'https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132',
								sex: '',
								headimgurl: '',
								scene: uni.getStorageSync('scene')
							}).then(res => {
								uni.setStorageSync('userId', res.data.user_id)

							})
						})
					},
				})

			}
		}
	}
</script>


<style lang="scss">
	@import "uview-ui/index.scss";

	page {
		background: #F9F9F9;
	}

	
</style>
